-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: entries gen for fs router projects #886
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to the vite world.
2d85ad5
to
20bcdd6
Compare
Commenting my findings from a bit of research so far here This plugin from the tanstact router is very similar to what we will want. It looks like they just use I was unable to get watchChange logging in my initial tests with out setup, but this leads me to think that it may be how we configure the vite config for the dev server maybe? Either way, it's a POC that The downside of their example is that afaict: They do not have a need to import anything like we do for our Since at this stage we are really just interested in collecting the routes for some autocomplete on the link paths, I think our best first option is to start with defaulting to I'll put together a draft of what this will look like tomorrow night and in doing so get rid of any notion of importing from the plugin to run getConfig. |
Another thing to add: I no longer think that making a generation of the entries file makes sense. With it just being a plugin that looks at what path you are on, we won't know the Instead I'll make something like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My TODO that I am planning for:
- Test with more types of
getConfigs
- clean up the code in the vite plugin file a bit
- run prettier on the generated output programatically
- fix the vite plugin to hot reload the generation when necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random replies.
05a93e5
to
2b6eadf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great!
examples/05_nossr/entries.gen.tsx
Outdated
import { createPages } from 'waku'; | ||
import type { PathsForPages } from 'waku/router'; | ||
|
||
import Layout, { getConfig as Layout_getConfig } from './src/pages/_layout'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will it be like when it's layout.tsx
instead of _layout.tsx
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we support both layout.tsx
and _layout.tsx
? If yes, what happens if a project has both in the same directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layout.tsx works the same as foo.tsx. So it will be /layout
like /foo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! that would have been in conflict. I fixed this with _Layout for the actual layouts' names and added a page named /layout to the fs-router example
95a2f03
to
f99ddb9
Compare
b901d57
to
e532d93
Compare
e532d93
to
a9cc6c7
Compare
Found the issue in the playwritght tests.... the vite plugin is creating bad paths in windows 😅 dang windows
|
@dai-shi I have the fixes for above locally... a few last questions
|
Yes, that's a tough one. We spent so many hours and even days fighting with it with @himself65 . |
Only top level. As we discussed, in the template, we expect people to commit
Yes, for all TS examples.
No. It can be like |
I think you misunderstood what I was referencing here. I mean |
Isn't it about the code in |
this at the top of that file: import _Layout, { getConfig as _Layout_getConfig } from './pages/_layout.js';
import About, { getConfig as About_getConfig } from './pages/about.js';
import Index, { getConfig as Index_getConfig } from './pages/index.js'; |
Yes, we can omit |
Sounds good, but there's no dynamic import? We dropped that idea a while ago |
3b287fb
to
810fc3d
Compare
as I went through each of the examples, I noticed that most use the My current understanding of the docs is that it only really suggests the fs-router |
810fc3d
to
25c0ed1
Compare
never mind. It was referring to |
So, there are two aspects (or goals) in Waku.
Obviously, I started as the first one, and I'm not thinking it a toy. My vision includes Jotai integration, multiple routers (router-agnostic API), and building ecosystem.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Outstanding work!
This PR will add a vite plugin for running on
waku dev
that will generateentries.gen.tsx
Tasks left
getConfig